 import javax.swing.*;
import java.awt.*;

public class PointD{
  public static void main(String[] args) {
  JFrame frame = new JFrame("Laying Out Components in a Grid");
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  JPanel panel = new JPanel(new GridLayout(5,2,20,50));
  panel.add(new JLabel("name"));
panel.add(new JTextField(5));
panel.add(new JLabel("x"));
panel.add(new JTextField(5));
panel.add(new JLabel("y"));
panel.add(new JTextField(5));

  panel.add(new JButton("Ok"));
  panel.add(new JButton("Cancel"));
  frame.add(panel);
  frame.setSize(400,400);
  frame.setVisible(true);
  }
}